package history.hot100.simple;

// 461. 汉明距离:https://leetcode-cn.com/problems/hamming-distance/
// https://leetcode-cn.com/problems/hamming-distance/solution/yi-ming-ju-chi-by-leetcode/
public class LeetCode_461 {
    public int hammingDistance(int x, int y) {
        int xor = x ^ y;
        int result = 0;
        while (xor!=0) {
            if (xor%2==1) result++;
            xor = xor>>1;
        }
        return result;
    }
}
